home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / srcuc.zip / DOSEXCP.H < prev    next >
C/C++ Source or Header  |  1992-05-05  |  3KB  |  107 lines

  1. /* -*-C-*-
  2.  
  3. $Header: /scheme/dos386/microcode/RCS/dosexcp.h,v 1.1 1992/05/05 06:55:13 jinx Exp $
  4.  
  5. Copyright (c) 1992 Massachusetts Institute of Technology
  6.  
  7. This material was developed by the Scheme project at the Massachusetts
  8. Institute of Technology, Department of Electrical Engineering and
  9. Computer Science.  Permission to copy this software, to redistribute
  10. it, and to use it for any purpose is granted, subject to the following
  11. restrictions and understandings.
  12.  
  13. 1. Any copy made of this software must include this copyright notice
  14. in full.
  15.  
  16. 2. Users of this software agree to make their best efforts (a) to
  17. return to the MIT Scheme project any improvements or extensions that
  18. they make, so that these may be included in future releases; and (b)
  19. to inform MIT of noteworthy uses of this software.
  20.  
  21. 3. All materials developed as a consequence of the use of this
  22. software shall duly acknowledge such use, in accordance with the usual
  23. standards of acknowledging credit in academic research.
  24.  
  25. 4. MIT has made no warrantee or representation that the operation of
  26. this software will be error-free, and MIT is under no obligation to
  27. provide any services, by way of maintenance, update, or otherwise.
  28.  
  29. 5. In conjunction with products arising from the use of this material,
  30. there shall be no use of the name of the Massachusetts Institute of
  31. Technology nor of any adaptation thereof in any advertising,
  32. promotional, or sales literature without prior written consent from
  33. MIT in each case. */
  34.  
  35. #ifndef _DOSEXCP_H_
  36. #  define _DOSEXCP_H_
  37.  
  38. #define NUM_DOS_EXCP                    18
  39.  
  40. #define DOS_INVALID_TRAP                -1
  41.  
  42. #define DOS_EXCP_Integer_divide_by_zero            0
  43. #define DOS_EXCP_Debug_exception            1
  44. #define DOS_EXCP_Non_maskable_interrupt            2
  45. #define DOS_EXCP_Breakpoint                3
  46. #define DOS_EXCP_Integer_overflow            4
  47. #define DOS_EXCP_Bounds_check                5
  48. #define DOS_EXCP_Invalid_opcode                6
  49. #define DOS_EXCP_Numeric_co_processor_not_available    7
  50. #define DOS_EXCP_Double_fault                8
  51. #define DOS_EXCP_Numeric_co_processor_segment_overrun    9
  52.   /* ^ can only occur on an FP-less chip (386 or 486SX). */
  53. #define DOS_EXCP_Invalid_TSS                10
  54. #define DOS_EXCP_Segment_not_present            11
  55. #define DOS_EXCP_Stack_exception            12
  56. #define DOS_EXCP_General_protection            13
  57. #define DOS_EXCP_Page_Fault                14
  58.   /* 15 is reserved by Intel. */
  59. #define DOS_EXCP_Floating_point_exception        16
  60. #define DOS_EXCP_Alignment_check            17
  61.   /* 18-31 are reserved by Intel. */
  62.  
  63. struct sigcontext
  64. {
  65.   unsigned sc_eax;
  66.   unsigned sc_ecx;
  67.   unsigned sc_edx;
  68.   unsigned sc_ebx;
  69.   unsigned sc_esp;
  70.   unsigned sc_ebp;
  71.   unsigned sc_esi;
  72.   unsigned sc_edi;
  73.   unsigned sc_eip;
  74.   unsigned sc_eflags;
  75.   unsigned sc_cs;
  76.   unsigned sc_ss;
  77.   unsigned sc_ds;
  78.   unsigned sc_es;
  79.   unsigned sc_fs;
  80.   unsigned sc_gs;
  81. };
  82.  
  83. extern int
  84.   DPMI_get_exception_vector (unsigned exception,
  85.                  unsigned short * cs_selector,
  86.                  unsigned * code_offset);
  87.  
  88. extern int
  89.   DPMI_set_exception_vector (unsigned exception,
  90.                  unsigned short cs_selector,
  91.                  unsigned code_offset);
  92.  
  93. extern int
  94.   DPMI_set_exception_handler (unsigned exception,
  95.                   void (*funcptr) (unsigned,
  96.                            unsigned,
  97.                            struct sigcontext *),
  98.                   void * stack);
  99.  
  100. extern int
  101.   DPMI_restore_exception_handler (unsigned exception,
  102.                   unsigned short cs_selector,
  103.                   unsigned code_offset);
  104.                   
  105.  
  106. #endif /* _DOSEXCP_H_ */
  107.